<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>
        // replace()
        // search()    indexOf  不接受正则
        // split()
        // match()   匹配   返回的是数组,配合g   找不到则返回null

        let str = 'Good good  study  ' ;
        // const arr = str.split(' ');
        const arr = str.trim().split(/\s+/) ;
        console.log(arr);

        const arr2 = str.trim().match(/god/ig);
        console.log(arr2);


    </script>
    
</body>
</html>